//
//  EngineeringButton.swift
//  BusinessIOS
//
//  Created by Rain on 2018/11/2.
//  Copyright © 2018 XingJian Li. All rights reserved.
//

import UIKit

class EngineeringButton: UIButton {
    
    
    var nameLabel: UILabel!
    var nameImageView:UIImageView!

    //MARK:- 重写init函数
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        
        self.nameImageView = UIImageView()
      
        self.addSubview(self.nameImageView)
        

        self.nameLabel = UILabel();

        self.nameLabel.textAlignment = .center

        self.nameLabel.font = UIFont.systemFont(ofSize:12)//一般方法
        self.addSubview(self.nameLabel)

 
    }
    
    //swift中规定:重写控件的init(frame方法)或者init()方法.必须重写 init?(coder aDecoder: NSCoder)
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override func layoutSubviews() {
        super.layoutSubviews()

        self.nameImageView.frame = CGRect(x: 30, y: 10, width: self.frame.size.width-60, height: 40)
        self.nameLabel.frame = CGRect(x: 0, y: 50, width: self.frame.size.width, height: 30)
        
    }
    


}
